package model

import (
	"time"

	"gorm.io/gorm"
)

type User struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	Username  string         `gorm:"unique;not null" json:"username"`
	Password  string         `gorm:"not null" json:"password"`
	Email     string         `gorm:"unique;not null" json:"email"`
	Phone     string         `gorm:"unique;not null" json:"phone"`
	OpenID    string         `json:"open_id" gorm:"unique"`
	UnionID   string         `json:"union_id"`
	Nickname  string         `json:"nickname"`
	Avatar    string         `json:"avatar"`
	Status    int            `json:"status"`
	Balance   float64        `json:"balance"`
	Points    int            `json:"points"`
	CreatedAt time.Time      `gorm:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"deleted_at" json:"deleted_at"`
}

func (User) TableName() string {
	return "users"
}
